﻿define(["require", "exports", "../../Scripts/photoweb/Server", "plugins/router"], function(require, exports, Server, router) {
    var AlbumsViewModel = (function () {
        function AlbumsViewModel(albums) {
            var _this = this;
            this.albums = albums;
            this.activate = function () {
                _this.isLoading(true);
                Server.getAlbums(function (response) {
                    _this.isLoading(false);
                    _this.albums(response);
                }, function (err) {
                    _this.isLoading(false);
                    alert(JSON.stringify(err));
                });
            };
            this.loadPicturesForAlbum = function (album) {
                router.navigate("#photos/" + encodeURIComponent(album.id));
            };
            this.albums = ko.observableArray();
            this.isLoading = ko.observable(true);
        }
        return AlbumsViewModel;
    })();

    
    return AlbumsViewModel;
});
//# sourceMappingURL=albums.js.map
